#ifndef _DISPLAY_H_
#define _DISPLAY_H_

#include "device/Device.h"

#include <cassert>
#include <cstdint>
#include <SDL2/SDL.h>
#include <SDL2/SDL_video.h>

#define VCTL_BASE 0xA0000100
#define VCTL_SIZE 8

#define SCREEN_W 400
#define SCREEN_H 300

#define VMEM_BASE 0xA1000000
#define VMEM_SIZE (sizeof(uint32_t) * SCREEN_W * SCREEN_H)

class Display : public Device {
private:
    SDL_Renderer *renderer;
    SDL_Texture *texture;
    SDL_Window *window;
    void update_screen();

    uint32_t vctl[2];
    uint8_t* vmem;
public:
    Display();
    ~Display();
    bool read(word_t start_addr, size_t length, uint8_t* buffer) override;
    bool write(word_t start_addr, size_t length, const uint8_t* buffer) override;
    void update() override;
};

#endif
